home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / globalStitchPreset.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.2 KB  |  119 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  October 1998
  22. //  Author:        mpw
  23. //
  24. //  Description:
  25. //      The globalStitchPreset() procedure executes a offset curve operation on 
  26. //      a curve based on the offset option vars.
  27. //
  28. //  Input Arguments:
  29. //      None.
  30. //
  31. //  Return Value:
  32. //      None.
  33. //
  34.  
  35. proc string pieceTogetherGlobalStitchCmd(
  36.      int $history,
  37.     int $replaceOriginal,
  38.     int $stitchCorners,
  39.     int $stitchEdges,
  40.     int $stitchSmoothness,
  41.     int $stitchInteriors,
  42.     float $maxSeparaion,
  43.     float $modificationResistance,
  44.     int $sampling)
  45. //
  46. //    Description :
  47. //        Piece together a globalStitch command.
  48. //
  49. {
  50.     string $cmd;
  51.     $cmd = "globalStitch ";
  52.  
  53.     // construction history
  54.     $cmd = $cmd + " -ch ";
  55.     if ( $history == 1 ) $cmd = $cmd + "on";
  56.     else  $cmd = $cmd + "off";
  57.  
  58.     $cmd = $cmd + " -rpo ";
  59.     if ( $replaceOriginal == 1 ) $cmd = $cmd + "on";
  60.     else  $cmd = $cmd + "off";
  61.     
  62.     // stitch options
  63.     $cmd = $cmd + " -sc " + $stitchCorners;
  64.     $cmd = $cmd + " -se " + $stitchEdges;
  65.     $cmd = $cmd + " -ss " + $stitchSmoothness;
  66.  
  67.     if($stitchInteriors == 1) $cmd = $cmd + " -spe true";
  68.     else  $cmd = $cmd + " -spe false";
  69.  
  70.     // max separation, modification resistance
  71.     // and sampling
  72.     $cmd = $cmd + " -ms " + $maxSeparaion;
  73.     $cmd = $cmd + " -mr " + $modificationResistance;
  74.     $cmd = $cmd + " -sam " + $sampling;
  75.  
  76.     return $cmd;
  77. }
  78.  
  79. global proc globalStitchPreset(
  80.      int $history,
  81.     int $replaceOriginal,
  82.     int $stitchCorners,
  83.     int $stitchEdges,
  84.     int $stitchSmoothness,
  85.     int $stitchInteriors,
  86.     float $maxSeparaion,
  87.     float $modificationResistance,
  88.     int $sampling)
  89. //
  90. //    globalStitch with the preset options.
  91. //    Use this proc when operation dragged to Shelf.
  92. //
  93. {
  94.     // build the command
  95.     string $cmd = pieceTogetherGlobalStitchCmd($history,
  96.                                                $replaceOriginal,
  97.                                                $stitchCorners,
  98.                                                $stitchEdges,
  99.                                                $stitchSmoothness,
  100.                                                $stitchInteriors,
  101.                                                $maxSeparaion,
  102.                                                $modificationResistance,
  103.                                                $sampling);
  104.  
  105.     global int $gSelectNurbsSurfacesBit;
  106.     string $srf[] = `filterExpand -ex true -sm $gSelectNurbsSurfacesBit`;
  107.  
  108.     // placeholder for one selection item
  109.     int $nsrf = size($srf);
  110.     int $i;
  111.     for($i=0; $i<$nsrf; $i++) {
  112.         $cmd += " " + $srf[$i];
  113.     }
  114.  
  115.     string $result[] = evalEcho($cmd);
  116.  
  117.     select -r $result;
  118. }
  119.